package amani.wechat.platform.utils;

import java.util.Date;

/**
 * 缓存对象
 * @author VV
 *
 */
public class CacheObject {
	public CacheObject(){
		
	}
	
	
	public Date expiredtime;
	
	public Object value;
	
	public Date  getExpiredtime(){
		return this.expiredtime;
	}
	
	/**
	 * 具体的过期时间
	 * @param expiredtime 过期时间日期
	 */
	public void setExpiredtime(Date expiredtime){
		this.expiredtime=expiredtime;
	}
	
	/**
	 * 从当前时间设置过期时间
	 * @param millisecond 增加的毫秒数
	 */
	public void setExpiredtime(long  millisecond){
		Date now=new Date();
		expiredtime=new Date(now.getTime()+millisecond); 
	}
	
	public void setValue(Object value){
		this.value=value;
	}
	
	public Object getValue(){
		return this.value;
	}
	
	/**
	 * 判断是否过期
	 * @return
	 */
	public boolean isExpired(){
		Date now=new Date();
		return !now.before(expiredtime);
	}

}
